﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ET.Monitor.DAL
{
    public class RealTimeDL
    {
        InvokeWebService iw = new InvokeWebService();
        string rtdbRelationAddress = "";
        string rtdbRealTimeAddress = "";
        string rtdbNameSpace = "";
        string rtdbJudge = "";

        public RealTimeDL()
        {
            rtdbRelationAddress = ConfigurationManager.ConnectionStrings["RelationURL"].ConnectionString;
            rtdbRealTimeAddress = ConfigurationManager.ConnectionStrings["RealTimeURL"].ConnectionString;
            rtdbNameSpace = ConfigurationManager.ConnectionStrings["NameSpace"].ConnectionString;
            rtdbJudge = ConfigurationManager.ConnectionStrings["Judge"].ConnectionString;
        }

        public double[] GetRTValues(string[] tags)
        {
            double[] ret = null;
            if (rtdbJudge == "1")
                ret = (double[])iw.RunWebService(rtdbRealTimeAddress, rtdbNameSpace, "GetRealValues", new object[] { tags });
            else
                ret = (double[])iw.RunWebService(rtdbRealTimeAddress, rtdbNameSpace, "GetRealValuesNoJudge", new object[] { tags });
            return ret;
        }

        public string Execute(string code)
        {


            return code;
        }
    }
}
